package com.lanvideo.entity;

import java.time.LocalDateTime;

/**
 * 考试答题记录实体类
 */
public class ExamAnswer {
    private Integer id;
    private Integer examId;
    private Integer studentId;
    private Integer questionId;
    private String studentAnswer; // 学生答案
    private String correctAnswer; // 正确答案
    private Boolean isCorrect; // 是否正确
    private LocalDateTime answerTime; // 答题时间
    
    // 关联字段
    private String questionContent;
    private String optionA;
    private String optionB;
    private String optionC;
    private String optionD;
    private Integer questionType; // 题目类型

    public ExamAnswer() {}

    public ExamAnswer(Integer examId, Integer studentId, Integer questionId, String studentAnswer, String correctAnswer) {
        this.examId = examId;
        this.studentId = studentId;
        this.questionId = questionId;
        this.studentAnswer = studentAnswer;
        this.correctAnswer = correctAnswer;
        this.isCorrect = studentAnswer != null && studentAnswer.equals(correctAnswer);
    }

    // Getters and Setters
    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public Integer getExamId() {
        return examId;
    }

    public void setExamId(Integer examId) {
        this.examId = examId;
    }

    public Integer getStudentId() {
        return studentId;
    }

    public void setStudentId(Integer studentId) {
        this.studentId = studentId;
    }

    public Integer getQuestionId() {
        return questionId;
    }

    public void setQuestionId(Integer questionId) {
        this.questionId = questionId;
    }

    public String getStudentAnswer() {
        return studentAnswer;
    }

    public void setStudentAnswer(String studentAnswer) {
        this.studentAnswer = studentAnswer;
    }

    public String getCorrectAnswer() {
        return correctAnswer;
    }

    public void setCorrectAnswer(String correctAnswer) {
        this.correctAnswer = correctAnswer;
    }

    public Boolean getIsCorrect() {
        return isCorrect;
    }

    public void setIsCorrect(Boolean isCorrect) {
        this.isCorrect = isCorrect;
    }

    public LocalDateTime getAnswerTime() {
        return answerTime;
    }

    public void setAnswerTime(LocalDateTime answerTime) {
        this.answerTime = answerTime;
    }

    public String getQuestionContent() {
        return questionContent;
    }

    public void setQuestionContent(String questionContent) {
        this.questionContent = questionContent;
    }

    public String getOptionA() {
        return optionA;
    }

    public void setOptionA(String optionA) {
        this.optionA = optionA;
    }

    public String getOptionB() {
        return optionB;
    }

    public void setOptionB(String optionB) {
        this.optionB = optionB;
    }

    public String getOptionC() {
        return optionC;
    }

    public void setOptionC(String optionC) {
        this.optionC = optionC;
    }

    public String getOptionD() {
        return optionD;
    }

    public void setOptionD(String optionD) {
        this.optionD = optionD;
    }

    public Integer getQuestionType() {
        return questionType;
    }

    public void setQuestionType(Integer questionType) {
        this.questionType = questionType;
    }

    @Override
    public String toString() {
        return "ExamAnswer{" +
                "id=" + id +
                ", examId=" + examId +
                ", studentId=" + studentId +
                ", questionId=" + questionId +
                ", studentAnswer='" + studentAnswer + '\'' +
                ", correctAnswer='" + correctAnswer + '\'' +
                ", isCorrect=" + isCorrect +
                ", answerTime=" + answerTime +
                '}';
    }
}
